﻿@page "/UPdataEmptyPage"
@inject UpdataServer updataServer
@using System.ComponentModel
@using AntDesign.TableModels
@inject ModalService _modalService
@inject MessageService _message
<h3>空卷缓存架更新</h3>
<div>
    <Row>
        <Col Span="24">
        <label>输入满卷缓存架编号</label>
        </Col>
    </Row>
    <Row>
        <Col Span="8" Push="8">
        <Input style="width:100%" @bind-Value="@Remark"></Input>
        </Col>
    </Row>
    @if (EmptyCache != null)
    {
        <Descriptions Title="缓存架信息">
            <DescriptionsItem Title="编号">@EmptyCache.Remark</DescriptionsItem>
        </Descriptions>
        <br>
        @if (EmptyCache.IsEnable == true && EmptyCache.IsCreat == false && EmptyCache.IsHave == true)
        {

            <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Creat1">更新为无料</Button>

        }
        else if (EmptyCache.IsEnable == true && EmptyCache.IsCreat == false && EmptyCache.IsHave == false)
        {
            <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Creat2">更新为有料</Button>
        }
    }
    <br>
    <br>
    <Row>
        <Col Span="24">
        <Button style="width:100%" Type="@ButtonType.Primary" @onclick="@Cheek">查询</Button>
        </Col>
    </Row>
</div>

@code {
    EmptyCache_Entity EmptyCache { get; set; } = null;
    string Remark { get; set; }

    protected override async Task OnInitializedAsync()
    {


        base.OnInitialized();
    }

    private async Task Cheek()
    {
        if (!string.IsNullOrEmpty(Remark))
        {
            EmptyCache = await updataServer.GetEmptyCache(Remark);
        }

    }

    private async Task Creat1()
    {
        _modalService.Confirm(new ConfirmOptions()
        {
            Title = "提示",
            Icon =@<Icon Type="exclamation-circle" Theme="Outline"></Icon>,
OkText = "确认",
OnOk = async (e) =>
{
var a = await updataServer.UpdataNoHaveEmpty(Remark);
_message.Info(a);
},
CancelText = "取消",
Content = "是否提交？",
});
}
private async Task Creat2()
{
_modalService.Confirm(new ConfirmOptions()
{
Title = "提示",
Icon =@<Icon Type="exclamation-circle" Theme="Outline"></Icon>,
OkText = "确认",
OnOk = async (e) =>
{
var a = await updataServer.UpdataHaveEmpty(Remark);
_message.Info(a);
},
CancelText = "取消",
Content = "是否提交？",
});
}
}

